export default {
    islogn(state) {
     return state.lognUser
    },
    cartLength(state) {
        return state.cart.reduce((total, currentValue)=> {
            return total + parseInt(currentValue.num)
        },0)
    },
    chooseCart(state) {
        return state.cart.reduce((total, currentValue)=> {
            return total + parseInt(currentValue.isChoose? currentValue.num : 0)
        },0)
    },
    money(state) {
        return state.cart.reduce((total, currentValue)=> {
            return total + parseInt(currentValue.isChoose ? currentValue.num * currentValue.price: 0)
        }, 0)
    },
    getChooseCart(state) {
        return state.cart.filter(item=> item.isChoose)
    }
}